package com.atguigu.eduservice.client;

import com.atguigu.commonutils.R;
import com.atguigu.eduservice.client.impl.BannerClientImpl;
import com.atguigu.eduservice.entity.CrmBanner;
import com.atguigu.eduservice.query.BannerQuery;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author alan
 */
@FeignClient(name = "service-cms", fallback = BannerClientImpl.class)
@Component
public interface BannerClient {

    @PostMapping("/cmsService/admin/banner/page")
    @ApiOperation("分页查询轮图")
    R pageBanner(BannerQuery query);

    @PostMapping("/cmsService/admin/banner/delete/{id}")
    @ApiOperation("通过ID删除轮播图")
    R delete(@PathVariable("id") String id);

    @ApiOperation("添加一个轮播图")
    @PostMapping("/cmsService/admin/banner/save")
    R save(@RequestBody CrmBanner banner);

    @ApiOperation("更新轮播图信息")
    @PostMapping("/cmsService/admin/banner/update")
    R update(@RequestBody CrmBanner banner);

    @PostMapping("/cmsService/user/banner/list")
    @ApiOperation("首页轮播图")
    R listBanner();
}
